package com.leyou.item.client;

import com.leyou.item.dto.SkuDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

@FeignClient("item-service")
public interface ItemClient {

    /**
     * 减库存
     * @param cartMap 商品id及数量的map
     */
    @PutMapping("/goods/stock/minus")
    void deductStock(@RequestBody Map<Long, Integer> cartMap);

    List<SkuDTO> querySkuByIds(List<Long> idList);

    /**
     * 加库存
     * @param cartMap 商品id及数量的map
     */
    @PutMapping("/goods/stock/plus")
    void addStock(@RequestBody Map<Long,Integer> cartMap);
}
